package com.bitejiuyeke.job_publish.common;

public enum ResultCode {
    /**
     * 定义状态码
     */
    SUCCESS(0, "成功"),
    FAILED(1000, "操作失败"),
    FAILED_UNAUTHORIZED(1001, "未授权"),
    FAILED_PARAMS_VALIDATE(1002, "参数校验失败"),
    FAILED_FORBIDDEN(1003, "禁止访问"),
    FAILED_CREATE(1004, "新增失败"),
    FAILED_NOT_EXISTS(1005, "资源不存在"),
    FAILED_NOT_PERMISSION(1006, "没有权限"),

    FAILED_USER_EXISTS(1101, "用户已存在"),
    FAILED_USER_NOT_EXISTS(1102, "用户不存在"),
    FAILED_LOGIN(1103, "用户名或密码错误"),
    FAILED_TWO_PWD_NOT_SAME(1105, "两次输入的密码不一致"),
    FAILED_PHONE_EXISTS(1106, "电话号码已存在"),
    FAILED_PHONE_NOT_EXISTS(1107, "电话号码不存在"),

    FAILED_EMAIL_EXISTS(1108, "电子邮箱已存在"),
    FAILED_EMAIL_NOT_EXISTS(1109, "电子邮箱不存在"),
    FAILED_TARGET_NUM_EXISTS(1110, "电话号码或邮箱地址已存在"),
    FAILED_TARGET_NUM_NOT_EXISTS(1111, "电话号码或邮箱地址不存在"),
    FAILED_CODE_VERIFY(1112, "验证码错误"),
    FAILED_UPLOAD_IS_NULL(1113, "上传的文件不能为空"),
    FAILED_UPLOAD(1114, "文件上传失败"),
    FAILED_JOB_EXISTS(1115, "职位已存在"),
    FAILED_JOB_NOT_EXISTS(1116, "职位不存在"),
    FAILED_JOB_NOT_RELEASED(1117, "职位不在发布中"),
    ERROR_SERVICES(2000, "服务器内部错误"),
    ERROR_IS_NULL(2001, "IS NULL.");

    // 状态码
    long code;
    // 状态描述
    String message;

    // 构造方法
    ResultCode(long code, String message) {
        this.code = code;
        this.message = message;
    }

    public long getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    @Override
    public String toString() {
        return "code = " + code + ", message = " + message + ". ";
    }
}
